/*
 * @Description:  显示点云、网格、设置颜色、连线  https://www.yuque.com/huangzhongqing/muam1n/nag8uv/
 * https://github.com/MNewBie/PCL-Notes/blob/master/chapter7.md
 * @Author: HCQ
 * @Company(School): UCAS
 * @Date: 2020-10-16 10:59:11
 * @LastEditors: HCQ
 * @LastEditTime: 2020-10-16 11:03:53
 */
#include <unistd.h>
#include <iostream>
#include <string>
#include <filesystem>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/ply_io.h>
#include <pcl/visualization/pcl_visualizer.h>

int main()
{
    // 1 获取项目路径
	std::filesystem::path path = std::filesystem::current_path();
	std::string images_path = path.replace_filename("images").string();

    // 2 读取点云
    pcl::PointCloud<PointXYZRGB>::Ptr cloud(new pcl::PointCloud<PointXYZRGB>);
    pcl::io::loadPLYFile(images_path + "/cloud.ply", *cloud);

    // 3 定义对象
    boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer(new pcl::visualization::PCLVisualizer("cloud viewer"));
    pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(cloud);

    // 4 筛选点云

    // 5 添加点云并显示
    viewer.addPointCloud(cloud, "3dmap");

    viewer.spin();
    return 0;
}